<!DOCTYPE html>
<html>
<head>
    <title>住宅房源管理</title>
<#include "../common/common.ftl"/>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <form class="layui-form" id="searchForm">
                <input type="hidden" name="zsProjectId" value="${(zsProjectId)!}"/>
                安置区：
                <div class="layui-inline" style="width: 120px;">
                    <input class="layui-input" name="search_like_string_p.projectName" autocomplete="off">
                </div>
                幢号：
                <div class="layui-inline" style="width: 120px;">
                    <input class="layui-input" name="search_eq_string_h.buildNum" autocomplete="off">
                </div>
                户号：
                <div class="layui-inline" style="width: 120px;">
                    <input class="layui-input" name="search_like_string_h.houseNum" autocomplete="off">
                </div>
                建筑面积：
                <div class="layui-inline" style="width: 120px;">
                    <input class="layui-input" name="buildAreaStr" autocomplete="off">
                </div>
                房屋户型：
                <div class="layui-inline" style="width: 180px;">
                    <select name="search_eq_string_h.houseHold" id="houseHoldSelect">
                        <option value="">--请选择--</option>
                    </select>
                </div>
                房屋属性：
                <div class="layui-inline" style="width: 120px;">
                    <input class="layui-input" name="search_like_string_h.houseStyle" autocomplete="off">
                </div>
                房源状态：
                <div class="layui-inline" style="width: 120px;">
                    <select name="search_eq_integer_h.houseStatus" id="houseStatusSelect">
                        <option value="">--请选择--</option>
                    </select>
                </div>
                <button class="layui-btn" type="button" id="searchButton"><i
                        class="layui-icon layui-icon-search"></i> 搜索
                </button>
            </form>
            <table id="dataTable" class="layui-table" lay-filter="layFilter"></table>
            <!--序号-->
            <script type="text/html" id="indexTpl">
                {{d.LAY_TABLE_INDEX+1}}
            </script>
            <!--菜单-->
            <!-- 表格头部工具栏 -->
            <script type="text/html" id="toolbar">
                <div class="layui-btn-container right">
                    <button lay-event="reload" class="layui-btn layui-btn-sm">
                        <i class="layui-icon layui-icon-refresh"></i>重载
                    </button>
                    <button lay-event="excelButton" class="layui-btn layui-btn-sm"><i
                            class="layui-icon layui-icon-layim-download"></i>房源数据导出
                    </button>
                </div>
            </script>
        </div>
    </div>

</div>
<script src="/layui/layui.js" charset="utf-8"></script>
<script>
    layui.config({
        base: '/modules/' //静态资源所在路径
    }).use(['table', 'form', 'jquery', 'jmdf', 'page', 'dataDict'], function () {
        var $ = layui.jquery, jmdf = layui.jmdf, page = layui.page, table = layui.table, form = layui.form, dataDict = layui.dataDict;
        /***********************table表格相关操作 start*************************/
        var tableRenderId = "renderId";
        var tableId = "dataTable";
        var table_layFilter = "layFilter";
        var tableUrl = "loadHouseList?zsProjectId=${(zsProjectId)!}";

        dataDict.select("房屋类型", "houseTypeSelect", "");
        dataDict.select("房屋户型", "houseHoldSelect", "");
        dataDict.select("房源状态", "houseStatusSelect", "");

        //列项内容
        var cols = [[
            {title: "序号", toolbar: '#indexTpl', fixed: 'left', align: 'center', width: 60}
            , {field: "azProjectName", title: "安置区", align: 'center', width: 200}
            , {field: "buildNum", title: "幢号", align: 'center', width: 120}
            , {field: "houseNum", title: "户号", align: 'center', width: 120}
            , {field: "houseHoldStr", title: "房屋户型", align: 'center', width: 150}
            , {field: "houseStyle", title: "房屋属性", align: 'center', width: 150}
            , {field: "buildArea", title: "建筑面积", align: 'center', width: 150}
            , {
                field: "houseStatus", title: "房源状态", align: 'center', width: 100, templet: function (d) {
                    return d.houseStatusStr;
                }
            }
            , {field: "chooseHouseDate", title: "选房时间", align: 'center', minWidth: 100}
            , {field: "memo", title: "备注", align: 'center', minWidth: 500}
        ]];
        //table设置项
        var options = {
            elem: '#' + tableId//table列表id值
            , url: tableUrl
            , toolbar: '#toolbar'//自定义工具栏
            , cols: cols
            , id: tableRenderId
            , defaultToolbar: ['filter', 'print']//显示列、打印
            , autoSort: false //禁用前端自动排序。
            , height: "full-160"
        };

        //初始表格（含分页设置）
        page.render(options);
        //表格排序
        page.sort(tableId, tableRenderId);
        //刷新当前页方法封装
        page.reload();

        //分页查询（查询条件）
        $("#searchButton").click(function () {
            page.search("searchForm", tableRenderId);
        });

        //头工具栏事件
        table.on('toolbar(' + table_layFilter + ')', function (obj) {
            switch (obj.event) {
                case 'reload':
                    loadData();
                    break;
                case 'excelButton':
                    location.href = 'houseListExcel?' + $("#searchForm").serialize();
                    break;
            }
        });

    });
</script>
</body>
</html>